﻿<UserControl x:Class="EX_NFC.FrontEnd.Windows.Controls.Mifare1K.TagAuthorizationControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <!-- ROW 0 -->
        <StackPanel Grid.Column="0"
                    Grid.ColumnSpan="4"
                    Grid.Row="0"
                    Orientation="Horizontal"
                    HorizontalAlignment="Center">
            <Button Content="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_GetAuthorization}"
                    Command="{Binding CommandGetAuthorizationBytes}"
                    Margin="{DynamicResource BasicMargin}"
                    Width="{DynamicResource MediumControlWidth}"
                    Height="{DynamicResource MediumControlHeight}" />
            <Button Content="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_SetAuthorization}"
                    Command="{Binding CommandSetAuthorizationBytes}"
                    Margin="{DynamicResource BasicMargin}"
                    Width="{DynamicResource MediumControlWidth}"
                    Height="{DynamicResource MediumControlHeight}" />
            <TextBlock Text="{Binding AccessBitInStringMode}"
                       VerticalAlignment="Center"
                       Margin="{DynamicResource BasicMargin}"/>
        </StackPanel>
        <!-- ROW 1 -->
        <TextBlock Text="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_Block0}"
                   Grid.Column="0"
                   Grid.Row="1" />
        <TextBlock Text="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_Block1}"
                   Grid.Column="1"
                   Grid.Row="1" />
        <TextBlock Text="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_Block2}"
                   Grid.Column="2"
                   Grid.Row="1" />
        <TextBlock Text="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_TrailerBlock}"
                   Grid.Column="3"
                   Grid.Row="1" />
        <!-- ROW 2 -->
        <ListView Grid.Column="0"
                  Grid.Row="2"
                  SelectedIndex="{Binding Block0Access}"
                  ItemsSource="{Binding DataBlockAuthorizationLines}">
            <ListView.View>
                <GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding ReadAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FirstColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding WriteAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_SecondColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding IncrementAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_ThirdColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding DecrementAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FourthColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding Application}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FifthColumn}" />
                </GridView>
            </ListView.View>
        </ListView>
        <ListView Grid.Column="1"
                  Grid.Row="2"
                  SelectedIndex="{Binding Block1Access}"
                  ItemsSource="{Binding DataBlockAuthorizationLines}">
            <ListView.View>
                <GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding ReadAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FirstColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding WriteAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_SecondColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding IncrementAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_ThirdColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding DecrementAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FourthColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding Application}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FifthColumn}" />
                </GridView>
            </ListView.View>
        </ListView>
        <ListView Grid.Column="2"
                  Grid.Row="2"
                  SelectedIndex="{Binding Block2Access}"
                  ItemsSource="{Binding DataBlockAuthorizationLines}">
            <ListView.View>
                <GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding ReadAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FirstColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding WriteAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_SecondColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding IncrementAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_ThirdColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding DecrementAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FourthColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding Application}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorization_FifthColumn}" />
                </GridView>
            </ListView.View>
        </ListView>
        <ListView Grid.Column="3"
                  Grid.Row="2"
                  SelectedIndex="{Binding TrailerBlockAccess}"
                  ItemsSource="{Binding TrailerBlockAuthorizationLines}">
            <ListView.View>
                <GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding KeyAReadAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorizationTrailer_FirstColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding KeyAWriteAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorizationTrailer_SecondColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding AccessBitReadAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorizationTrailer_ThirdColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding AccessBitWriteAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorizationTrailer_FourthColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding KeyBWriteAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorizationTrailer_FifthColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding KeyBReadAccess}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorizationTrailer_SixColumn}" />
                    <GridViewColumn DisplayMemberBinding="{Binding Remark}"
                                    Header="{Binding Source={StaticResource Localizer},Path=Localize.Mifare1KAuthorizationTrailer_SevenColumn}" />
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>
